﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using System.Windows;

namespace Informant.UI.Wpf.Converters
{
	public class InverseBooleanToVisibilityConverter :IValueConverter
	{
		#region IValueConverter Members

		public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
		{
			Object result = Binding.DoNothing;
			if (value != null)
			{
				Boolean boolean;
				if (Boolean.TryParse(value.ToString(), out boolean))
				{
					if (boolean)
					{
						result = Visibility.Collapsed;
					}
					else
					{
						result = Visibility.Visible;
					}
				}
			}
			return result;
		}

		public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
		{
			throw new NotImplementedException();
		}

		#endregion
	}
}
